/**
 * Redux actionCreator creator
 * @param {string} type - type of the action
 * @param {string[]} [propNames] - names of other properties of the action
 */

const createAction = (type, propNames) => (...args) => {
  const action = { type };
  propNames.forEach((propName, i) => {
    action[propName] = args[i];
  });
  return action;
};

export default createAction;
